<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><title>GNUcode.me</title><id>https://gnucode.me/feeds/tags/guile scheme dovecot.xml</id><subtitle>Tag: guile scheme dovecot</subtitle><updated>2024-05-08T13:40:23Z</updated><link href="https://gnucode.me/feeds/tags/guile scheme dovecot.xml" rel="self" /><link href="https://gnucode.me" /><entry><title>A Locally Running Dovecot in Guix</title><id>https://gnucode.me/a-locally-running-dovecot-in-guix.html</id><author><name>Joshua Branson</name><email>jbranso@dismail.de</email></author><updated>2021-06-08T01:41:00Z</updated><link href="https://gnucode.me/a-locally-running-dovecot-in-guix.html" rel="alternate" /><content type="html">&lt;p&gt;So, I have been wanting to set up a locally running dovecot server for a LONG
time now.  Essentially I have an email account at &lt;a href=&quot;dismail.de&quot;&gt;dismail.de&lt;/a&gt;, and
Emacs' &lt;a href=&quot;https://www.gnu.org/software/emacs/manual/html_node/gnus/&quot;&gt;Gnus&lt;/a&gt; is
pretty slow at searching for my emails.  I could switch to using mu4e or
notmuch, which ARE BLAZINGLY fast at searching your emails, BUT after listening
to John Wiegley, who is one of the current
&lt;a href=&quot;https://www.gnu.org/software/emacs/&quot;&gt;Emacs&lt;/a&gt; maintainers, talk about how Emacs'
Gnus mode is so cool...I've been using Gnus ever since.  Essentially Gnus is a
newsreader.  It is a way to handle lots news that is similar to reddit.  In
Gnus, after you've read a message, you do not see it again by default.  This is
handy, because since you are getting so much email, it's useful to only see
messages that you have not read.&lt;/p&gt;&lt;p&gt;Emacs's Gnus is actually the best way I've seen at handling LOTS of email,
particularly mailing lists.  For example, I am currently subscribed to
&lt;a href=&quot;https://lists.gnu.org/mailman/listinfo/guix-devel&quot;&gt;guix-devel&lt;/a&gt;,
&lt;a href=&quot;https://lists.gnu.org/mailman/listinfo/help-guix&quot;&gt;help-guix&lt;/a&gt;, and
&lt;a href=&quot;https://lists.gnu.org/mailman/listinfo/bug-hurd&quot;&gt;bug-hurd&lt;/a&gt;.  With Gnus, I can
open up these email folders and I only see messages that I have not read, AND
the emails are organized by threads NOT date:&lt;/p&gt;&lt;p&gt;&lt;img src=&quot;./images/gnus-thread.png&quot; alt=&quot;Image&quot; /&gt;&lt;/p&gt;&lt;p&gt;With my cursor on the top of the thread, pressing C-k, will kill the entire
thread.  So when I open up this folder again, I will not see that thread.  Let's
suppose that I've read all of the messages in that thread &amp;quot;Re: website: A little
help running the website locally&amp;quot;.  So that now Gnus looks like this when I open
it up:&lt;/p&gt;&lt;p&gt;&lt;img src=&quot;./images/gnus-thread-all-but-one.png&quot; alt=&quot;Image&quot; /&gt;&lt;/p&gt;&lt;p&gt;Pressing Shift-A-Shift-T, will pull up the entire thread, so that I can re-read
the whole conversation:&lt;/p&gt;&lt;p&gt;&lt;img src=&quot;./images/gnus-thread-all-but-one-reopened.png&quot; alt=&quot;Image&quot; /&gt;&lt;/p&gt;&lt;p&gt;Anyway, the main problem that I have had with Gnus (for years...I should have
fixed this a long time ago), is that it is REALLY slow and pretty much not
responsive at searching for my email.  I could try to search for my email with
Gnus, but it would typically fail.  I guess that something with dismail's
servers are wonky, because I did not have this problem when I had a paid
&lt;a href=&quot;fastmail.com&quot;&gt;fastmail&lt;/a&gt; account.&lt;/p&gt;&lt;p&gt;So, one solution to continue using Gnus, but have decent searching is to have a
locally running &lt;a href=&quot;https://www.dovecot.org/&quot;&gt;dovecot&lt;/a&gt; server that will serve my
emails.  I'll also be querying that local server instead of the remote one.
Sounds plausible.  Here's what you need to do:&lt;/p&gt;&lt;p&gt;First you need to fetch your remote email and put it in a local
&lt;a href=&quot;https://en.wikipedia.org/wiki/Maildir&quot;&gt;maildir&lt;/a&gt;. I prefer
&lt;a href=&quot;https://isync.sourceforge.io/mbsync.html&quot;&gt;mbsync&lt;/a&gt;, because it is what all the
cool kids are doing.&lt;/p&gt;&lt;p&gt;Here is my  &lt;code&gt;~/.mbsyncrc&lt;/code&gt;&lt;/p&gt;&lt;pre&gt;&lt;code&gt;IMAPAccount dismail
# Address to connect to
Host imap.dismail.de
User jbranso@dismail.de
Pass VERYSECRETPASSWORD
# To store the password in an encrypted file use PassCmd instead of Pass
# PassCmd &amp;quot;gpg2 -q --for-your-eyes-only --no-tty -d ~/.mailpass.gpg&amp;quot;
#
# Use SSL
SSLType IMAPS
CertificateFile /etc/ssl/certs/ca-certificates.crt

IMAPStore dismail-remote
Account dismail

MaildirStore dismail-local
Subfolders Verbatim
# The trailing &amp;quot;/&amp;quot; is important
Path ~/.mail/dismail.de/
Inbox ~/.mail/dismail.de/Inbox

Channel dismail
Master :dismail-remote:
Slave :dismail-local:
# show all folders
Patterns *
# Automatically create missing mailboxes, both locally and on the server
Create Both
# Save the synchronization state files in the relevant directory
SyncState *&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;code&gt;mbsync -a&lt;/code&gt;  running in a cron job, syncs up my email.  The config in guix for
that looks like so:&lt;/p&gt;&lt;pre&gt;&lt;code class=&quot;language-scheme&quot;&gt;(define mbsync-every-5-minutes
  ;; The job's action is a shell command.
  #~(job &amp;quot;*/5 * * * *&amp;quot;            ;Vixie cron syntax
         &amp;quot;mbsync -Va&amp;quot;
         #:user &amp;quot;joshua&amp;quot;))

...
(operating-system
...
(services
    (append
        (list
            (service mcron-service-type
                (mcron-configuration
                     (jobs (list mbsync-every-5-minutes)))))
     %desktop-services)))&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Now all we need is the configuration for a locally running dovecot server, which
looks like so:&lt;/p&gt;&lt;pre&gt;&lt;code class=&quot;language-scheme&quot;&gt;(dovecot-service #:config
                     (dovecot-configuration
                      (mail-location &amp;quot;maildir:~/.mail/dismail.de:LAYOUT=fs&amp;quot;)
                      (listen '(&amp;quot;127.0.0.1&amp;quot;))
                      ;; I do not need ssl support in a locally running dovecot.  :)
                      (ssl? &amp;quot;no&amp;quot;)
                      (protocols
                       (list (protocol-configuration
                              (name &amp;quot;imap&amp;quot;)
                              (mail-max-userip-connections 1))))
                      (services (list
                                 (service-configuration
                                  (kind &amp;quot;imap&amp;quot;)
                                  (client-limit 1)))))&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The bit that really got me confused for a while was that I needed &lt;strong&gt;LAYOUT=fs&lt;/strong&gt;
in the mail-location line.  Essentially, isync creates a maildir in a slightly
different format than what dovecot expects.  Adding in the &amp;quot;LAYOUT=fs&amp;quot; fixes this.&lt;/p&gt;&lt;p&gt;The last bit is we have to tell Emacs how to connect to the server:&lt;/p&gt;&lt;pre&gt;&lt;code class=&quot;language-scheme&quot;&gt;(setq
 user-mail-address &amp;quot;myemailaccount@dismail.de&amp;quot;
 user-full-name &amp;quot;Joshua Branson&amp;quot;)

(setq gnus-secondary-select-methods
     '((nnimap &amp;quot;localDismail&amp;quot;
               (nnimap-address &amp;quot;localhost&amp;quot;)
               (nnimap-stream network)
               (nnimap-server-port 143)
               )))&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Pretty cool stuff?  Right!?&lt;/p&gt;</content></entry></feed>